<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>for循环 | 个人笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/js/ES6.html" />
    
    
    <link rel="prev" href="../../md/js/循环语句.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.11"
        data-chapter-title="for循环"
        data-filepath="md/js/for循环.md"
        data-basepath="../.."
        data-revision="Mon Sep 03 2018 20:26:06 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html介绍.html">
            
                
                    <a href="../../md/html/html介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        html介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/html常用标签.html">
            
                
                    <a href="../../md/html/html常用标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        html常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a标签的使用.html">
            
                
                    <a href="../../md/html/a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/表格的介绍.html">
            
                
                    <a href="../../md/html/表格的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表格的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/列表.html">
            
                
                    <a href="../../md/html/列表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/iframe内嵌框架.html">
            
                
                    <a href="../../md/html/iframe内嵌框架.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        iframe内嵌框架
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/表单.html">
            
                
                    <a href="../../md/html/表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/媒体标签.html">
            
                
                    <a href="../../md/html/媒体标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        媒体标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/下拉框，多行文本域以及对齐方式.html">
            
                
                    <a href="../../md/html/下拉框，多行文本域以及对齐方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        清除样式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css引入方式.html">
            
                
                    <a href="../../md/css/css引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        css引入方式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/css选择符与选择器.html">
            
                
                    <a href="../../md/css/css选择符与选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        css选择符与选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/css字体样式.html">
            
                
                    <a href="../../md/css/css字体样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        css字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/图片的调整.html">
            
                
                    <a href="../../md/css/图片的调整.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        图片的调整
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/伪类选择.html">
            
                
                    <a href="../../md/css/伪类选择.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/盒子模型.html">
            
                
                    <a href="../../md/css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/浮动.html">
            
                
                    <a href="../../md/css/浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/定位.html">
            
                
                    <a href="../../md/css/定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/阴影.html">
            
                
                    <a href="../../md/css/阴影.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        阴影
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/图片溢出处理.html">
            
                
                    <a href="../../md/css/图片溢出处理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        图片溢出处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/动画.html">
            
                
                    <a href="../../md/css/动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="md/css/动画插件.html">
            
                
                    <a href="../../md/css/动画插件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        动画插件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/旋转菜单.html">
            
                
                    <a href="../../md/css/旋转菜单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        旋转菜单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="md/css/视口.html">
            
                
                    <a href="../../md/css/视口.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="md/css/rem布局.html">
            
                
                    <a href="../../md/css/rem布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="md/css/权重与雪碧图.html">
            
                
                    <a href="../../md/css/权重与雪碧图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        权重问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="md/css/移动底部菜单被系统键盘顶起问题.html">
            
                
                    <a href="../../md/css/移动底部菜单被系统键盘顶起问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.16.</b>
                        
                        移动端导航问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="md/css/flex布局.html">
            
                
                    <a href="../../md/css/flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.17.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="md/css/fullpage的使用.html">
            
                
                    <a href="../../md/css/fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.18.</b>
                        
                        fullpage
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="md/css/bootstrap.html">
            
                
                    <a href="../../md/css/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.19.</b>
                        
                        bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="md/css/媒体查询.html">
            
                
                    <a href="../../md/css/媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.20.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/js/js的介绍.html">
            
                
                    <a href="../../md/js/js的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        JavaScript的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="md/js/JavaScript数据类型.html">
            
                
                    <a href="../../md/js/JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        JavaScript数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/js/数据类型的转换.html">
            
                
                    <a href="../../md/js/数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/js/运算符.html">
            
                
                    <a href="../../md/js/运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="md/js/比较运算符.html">
            
                
                    <a href="../../md/js/比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="md/js/赋值运算符.html">
            
                
                    <a href="../../md/js/赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="md/js/逻辑操作符.html">
            
                
                    <a href="../../md/js/逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="md/js/条件语句.html">
            
                
                    <a href="../../md/js/条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="md/js/条件运算符.html">
            
                
                    <a href="../../md/js/条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="md/js/位运算符.html">
            
                
                    <a href="../../md/js/位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="md/js/循环语句.html">
            
                
                    <a href="../../md/js/循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.11" data-path="md/js/for循环.html">
            
                
                    <a href="../../md/js/for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="md/js/ES6.html">
            
                
                    <a href="../../md/js/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        ES6
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="md/js/内置对象.html">
            
                
                    <a href="../../md/js/内置对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        内置对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="md/js/Array对象.html">
            
                
                    <a href="../../md/js/Array对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        Array对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="md/js/Date对象.html">
            
                
                    <a href="../../md/js/Date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="md/js/布尔值对象.html">
            
                
                    <a href="../../md/js/布尔值对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.16.</b>
                        
                        布尔值对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.17" data-path="md/js/数学对象.html">
            
                
                    <a href="../../md/js/数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.17.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.18" data-path="md/js/对象的创建.html">
            
                
                    <a href="../../md/js/对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.18.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.19" data-path="md/js/BOM.html">
            
                
                    <a href="../../md/js/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.19.</b>
                        
                        BOM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.20" data-path="md/js/DOM关于元素的获取.html">
            
                
                    <a href="../../md/js/DOM关于元素的获取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.20.</b>
                        
                        DOM关于元素的获取
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.21" data-path="md/js/DOM元素对象.html">
            
                
                    <a href="../../md/js/DOM元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.21.</b>
                        
                        DOM元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.22" data-path="md/js/DOM事件练习.html">
            
                
                    <a href="../../md/js/DOM事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.22.</b>
                        
                        DOM事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.23" data-path="md/js/DOM鼠标事件.html">
            
                
                    <a href="../../md/js/DOM鼠标事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.23.</b>
                        
                        DOM鼠标事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.24" data-path="md/js/事件代理.html">
            
                
                    <a href="../../md/js/事件代理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.24.</b>
                        
                        事件代理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.25" data-path="md/js/移动端事件.html">
            
                
                    <a href="../../md/js/移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.25.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.26" data-path="md/js/无缝轮播图.html">
            
                
                    <a href="../../md/js/无缝轮播图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.26.</b>
                        
                        无缝轮播图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.27" data-path="md/js/鼠标事件练习.html">
            
                
                    <a href="../../md/js/鼠标事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.27.</b>
                        
                        鼠标事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.28" data-path="md/js/ajax.html">
            
                
                    <a href="../../md/js/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.28.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.29" data-path="md/js/高德地图的使用.html">
            
                
                    <a href="../../md/js/高德地图的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.29.</b>
                        
                        高德地图的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.30" data-path="md/js/预加载插件使用.html">
            
                
                    <a href="../../md/js/预加载插件使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.30.</b>
                        
                        预加载插件使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/jQuery/JQ变量的声明.html">
            
                
                    <a href="../../md/jQuery/JQ变量的声明.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JQ变量的声明
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/jQuery/选择器和效果.html">
            
                
                    <a href="../../md/jQuery/选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/jQuery/属性.html">
            
                
                    <a href="../../md/jQuery/属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="md/jQuery/尺寸.html">
            
                
                    <a href="../../md/jQuery/尺寸.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        尺寸
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/jQuery/遍历.html">
            
                
                    <a href="../../md/jQuery/遍历.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/jQuery/正则表达式.html">
            
                
                    <a href="../../md/jQuery/正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/jQuery/jQuery事件练习.html">
            
                
                    <a href="../../md/jQuery/jQuery事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        jQuery事件练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="gitbook的安装.html">
            
                
                    <a href="../../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >个人笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <p>1&#x3001;for&#x5FAA;&#x73AF;</p>
<pre><code>         * &#x8BED;&#x6CD5;&#xFF1A;

         *     for(&#x8BED;&#x53E5;&#x4E00;&#xFF1B;&#x8BED;&#x53E5;&#x4E8C;&#xFF1B;&#x8BED;&#x53E5;&#x4E09;){

         *         &#x9700;&#x8981;&#x5FAA;&#x73AF;&#x6267;&#x884C;&#x7684;&#x5185;&#x5BB9;

         * }

         * 1&#x3001;&#x8BED;&#x53E5;&#x4E00;&#xFF1A;&#x521D;&#x59CB;&#x5316;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x7684;&#x521D;&#x59CB;&#x503C;

         * 2&#x3001;&#x8BED;&#x53E5;&#x4E8C;&#xFF1A;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x8BED;&#x53E5;

         * 3&#x3001;&#x8BED;&#x53E5;&#x4E09;&#xFF1A;&#x521D;&#x59CB;&#x503C;&#x7684;&#x81EA;&#x589E;&#x91CF;
         * 
         * &#x5FAA;&#x73AF;&#x8FC7;&#x7A0B;&#xFF0C;&#x5148;&#x8FDB;&#x884C;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#xFF0C;&#x4E3A;true&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FDB;&#x5165;&#x5FAA;&#x574F;&#x4F53;&#xFF0C;&#x6267;&#x884C;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x7136;&#x540E;&#x8FDB;&#x884C;&#x81EA;&#x589E;&#xFF0C;

         * &#x81EA;&#x589E;&#x4E4B;&#x540E;&#x53C8;&#x8FDB;&#x5165;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#xFF0C;&#x4E3A;true&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FDB;&#x5165;&#x5FAA;&#x574F;&#x4F53;&#xFF0C;&#x7136;&#x540E;&#x6267;&#x884C;&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x7136;&#x540E;&#x8FDB;&#x5165;&#x81EA;&#x589E;&#xFF0C;

         * &#x81EA;&#x589E;&#x4E4B;&#x540E;&#x518D;&#x6B21;&#x8FDB;&#x5165;&#x5224;&#x65AD;&#x8BED;&#x53E5;&#x5982;&#x6B64;&#x5F80;&#x8FD4;&#x5FAA;&#x574F;&#xFF0C;&#x76F4;&#x5230;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#x4E3A;false&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8DF3;&#x51FA;&#x5FAA;&#x574F;&#x3002;
</code></pre><pre><code>for(var i = 0; i &lt; 5; i++) {
                console.log(&quot;test&quot;);
            }

            var i = 0;
            for(; i &lt; 5;) {
                i++;
                console.log(&quot;test&quot;);
            }

            for(var i = 1; i &lt;= 5; i++) {
                console.log(i);
            }

            for(var j = 1; j &lt;= 10; j++) {
                if(j % 2 == 0) {
                    console.log(j);
                }
            }
            /*
             *j++&gt;=j=j+1
             * j+=&gt;=j=j+2
             * 
             * */
            for(var j = 2; j &lt;= 10; j += 2) {
                console.log(j);
            }

            for(var i = 1; i &lt;= 10; i += 2) {
                console.log(i);
            }

            //&#x8BA1;&#x7B97;5&#x7684;&#x9636;&#x4E58;&#xFF1A;5&#xFF01;=5*4*3*2*1
            var num = 1;
            for(var i = 1; i &lt;= 5; i++) {
                num *= i;
            }
            console.log(num);

            var result = 1;
            for(var i = 1; i &lt;= 5; i++) {
                document.write(&quot;result&quot; + &quot;=&quot; + result + &quot;*&quot; + i);
                result = result * i;
                document.write(&quot;&lt;br /&gt;&quot;)
            }
            console.log(result);

            var num = 0;
            for(var i = 1; i &lt;= 10; i++) {
                num += i;
            }

            console.log(num);
</code></pre><p>break,&#x662F;&#x7528;&#x4E8E;switch&#x8BED;&#x53E5;&#x548C;&#x5FAA;&#x574F;&#x91CC;&#x9762;&#x7684;&#xFF0C;&#x7528;&#x4E8E;&#x7EC8;&#x6B62;&#x8BED;&#x53E5;&#x3002;</p>
<p>continue&#x7528;&#x4E8E;&#x5FAA;&#x73AF;&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6765;&#x8DF3;&#x8FC7;&#x5FAA;&#x73AF;&#x4E2D;&#x7684;&#x67D0;&#x4E00;&#x6B21;&#x6B21;&#x5FAA;&#x73AF;&#xFF08;&#x4E00;&#x4E2A;&#x8FED;&#x4EE3;&#xFF09;&#x3002;</p>
<pre><code>var name = &quot;123&quot;;
            switch(name){
                case &quot;123&quot;:
                    console.log(&quot;123&quot;);
                break;
                case &quot;678&quot;:
                   console.log(&quot;678&quot;);
                  break;
                default:
                    console.log(&quot;456&quot;);
            }

            for(var i=0;i&lt;5;i++){
                if(i==2){
                    break;
                }
                console.log(i);
            }

            for (var i=0;i&lt;5;i++) {
                if(i==2){
                    continue;
                }
                console.log(i);
            }
</code></pre><p>&#x591A;&#x5C42;&#x5FAA;&#x73AF;</p>
<pre><code>    for(var i = 0; i &lt; 3; i++) {
                console.log(&quot;&#x6211;&#x5728;&#x5916;&#x9762;&quot;);
                for(var j = 0; j &lt; 5; j++) {
                    console.log(&quot;&#x6211;&#x5728;&#x91CC;&#x9762;&quot;);
                }
            }

            for(var i = 0; i &lt; 4; i++) {
                for(var j = 0; j &lt; 6; j++) {
                    document.write(&quot;*&quot;);
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }
            //&#x65B9;&#x6CD5;&#x4E00;
            for(var i = 0; i &lt; 5; i++) {
                for(var j = 0; j &lt;= 5; j++) {
                    if(j &lt;= i) {
                        document.write(&quot;*&quot;);
                    }
                }
                document.write(&quot;&lt;br/&gt;&quot;);
            }
            //&#x65B9;&#x6CD5;&#x4E8C;
            for(var i = 0; i &lt; 5; i++) {
                for(var j = 0; j &lt;= i; j++) {
                    document.write(&quot;*&quot;);
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }

            for(var i = 1; i &lt; 6; i++) {
                for(var j = 1; j &lt; 6; j++) {
                    if(j &gt; (5 - i)) {
                        document.write(&quot;*&quot;);
                    } else {
                        document.write(&quot;&lt;i style=&apos;color: transparent;&apos;&gt;*&lt;/i&gt;&quot;);
                    }
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }
            //              6    6    6    6
            //            i 1 2    3    4    5
            //            j 5 4.6  3.7  2.8   9
            //                  4    4    4
            //            j=6-i||j=4+i
            for(var i = 1; i &lt;= 5; i++) {
                document.write(i);
                for(var j = 1; j &lt;= 9; j++) {
                    if(j == (6 - i) || j == (4 + i) || i == 5) {
                        document.write(&quot;*&quot;);
                    } else {
                        document.write(&quot;&lt;i style=&apos;color: transparent;&apos;&gt;*&lt;/i&gt;&quot;);
                    }
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }
            //            
            //            1000   1010  1020.1  1030.301
            //            10       10.1  10.201  10.30301
            /*
             *&#x672C;&#x606F;&#x548C;=&#x672C;&#x91D1;+&#x672C;&#x91D1;*&#x5229;&#x606F;
             * 
             * */
            var result = 1000;
            for(var i = 0; i &lt; 30; i++) {
                result = result + result * 0.01
            }
            console.log(result);

            var mony = 1000;
            for(var i = 1; i &lt;= 30; i++) {
                mony += (mony * 0.01)
            }
            console.log(mony);

            var rmb = 1010;
            for(var i = 1; i &lt;= 22; i++) {
                rmb += (rmb * 0.01);
            }

            console.log(rmb);

            for (var i=1;i&lt;=9;i++) {
                for (var j=1;j&lt;=9;j++) {
                    if(j&lt;=i){
                        document.write(i+&quot;*&quot;+j+&quot;=&quot;+i*j );
                    }
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }
            for (var i=1;i&lt;=9;i++){
                for (var j=1;j&lt;=9;j++) {
                    if(j&gt;(9-i)){
                        document.write(i+&quot;*&quot;+j+&quot;=&quot;+i*j);
                    }else{
                        document.write(&quot;&lt;i style=&apos;color: transparent;&apos;&gt;*&lt;/i&gt;&quot;)
                    }
                }
                document.write(&quot;&lt;br /&gt;&quot;);
            }

            var sum = 0;
             var x = 2;
             var y = 1;
             for(var i= 0;i&lt;20;i++){
                 var div = x/y;
                 var t = x;
                 x = x+y;
                 y = t;
                 sum+=div;
             }
                 console.log(sum);
</code></pre><p> for...in&#x5FAA;&#x73AF;</p>
<pre><code>            var arr=[1,2,3,4,5];
            for(item in arr){
                console.log(item,arr[item]);
            }
            for (var i=0;i&lt;arr.length;i++) {
                console.log(i,arr[i]);
            }
            var person={
                name:&quot;&#x5434;&#x4EA6;&#x51E1;&quot;,
                age:&quot;13&quot;,
                sex:&quot;&#x5973;&quot;,
                skill:function(){
                    console.log(&quot;&#x52A0;&#x62FF;&#x5927;&#x70AE;&#x738B;&quot;);
                }
            }
            for(item in person){
                console.log(item,person[item]);
            }

            //for-in&#x5FAA;&#x73AF;&#x7684;&#x6709;&#x8DA3;&#x7528;&#x6CD5;,&#x53EF;&#x4EE5;&#x901A;&#x8FC7;for-in&#x5FAA;&#x73AF;&#x628A;&#x5BF9;&#x8C61;&#x7684;&#x952E;&#x540D;&#x4FDD;&#x5B58;&#x5230;&#x6570;&#x7EC4;&#x91CC;&#x9762;
            var arr1=[];
            var j=0;
            for(arr1[j++] in person){

            }
            console.log(arr1);

            //&#x600E;&#x4E48;&#x6E05;&#x7A7A;&#x6570;&#x7EC4;
            //&#x65B9;&#x6CD5;&#x4E00;
            arr1=[];
            console.log(arr1);
            //&#x65B9;&#x6CD5;&#x4E8C;
            arr1.length=0;
            console.log(arr1);

            var str = &quot;678&quot;;
            for(item in str){
                console.log(item,str[item]);
            }
</code></pre><p>try{</p>
<pre><code>&#x4E66;&#x5199;&#x9700;&#x8981;&#x68C0;&#x6D4B;&#x7684;&#x4EE3;&#x7801;
</code></pre><p> }catch(e){</p>
<p>e&#x4EE3;&#x8868;&#x5F53;try&#x8BED;&#x53E5;&#x4E2D;&#x4EE3;&#x7801;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F20;&#x9012;&#x8FC7;&#x6765;&#x7684;&#x53C2;&#x6570;&#x3002;</p>
<p>&#x4E66;&#x5199;&#x8FD4;&#x56DE;&#x7684;&#x9519;&#x8BEF;
}</p>
<pre><code>try{
            var str=&quot;789&quot;;
                console.log(str);
            }catch(e){
                    console.log(e.message);
                    //&#x81EA;&#x5B9A;&#x4E49;&#x4EE3;&#x7801;&#x9519;&#x8BEF;&#x63D0;&#x793A;
                    var err=e.message;
                    var txt = &quot;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF1A;&quot;;
                    alert(txt+err);

            }

            function test(){
                var num=prompt(&quot;&#x8BF7;&#x8F93;&#x5165;&#x4E00;&#x4E2A;&#x5927;&#x4E8E;3&#x7684;&#x6570;&quot;);
                try{
                console.log(num,typeof num);
//                &#x7A7A;&#x5B57;&#x7B26;&#x4E32;&#x7528;&#x4E8E;&#x5224;&#x65AD;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x81EA;&#x52A8;&#x8F6C;&#x6362;&#x4E3A;&#x6570;&#x503C;0(&#x53E6;&#x4E00;&#x4E2A;&#x503C;&#x4E3A;&#x6570;&#x503C;&#x7684;&#x60C5;&#x51B5;&#x4E0B;)&#xFF1B;&#x6240;&#x4EE5;&#x9700;&#x8981;&#x628A;if(num==&quot;&quot;)&#x8FD9;&#x4E2A;&#x5224;&#x65AD;&#x653E;&#x5728;&#x6700;&#x524D;&#x9762;
                    if(num==&quot;&quot;) throw &quot;&#x4F60;&#x6CA1;&#x6709;&#x8F93;&#x5165;&#x4EFB;&#x4F55;&#x4E1C;&#x897F;&quot;;
                    if(num==null) throw &quot;&#x4F60;&#x53D6;&#x6D88;&#x4E86;&quot;;
                    if(num&lt;=3) throw &quot;&#x4F60;&#x8F93;&#x5165;&#x7684;&#x6570;&#x503C;&#x592A;&#x5C0F;&quot;;
                    if(isNaN(num)) throw &quot;&#x4F60;&#x8F93;&#x5165;&#x7684;&#x4E0D;&#x662F;&#x6570;&#x503C;&quot;;
                }catch(e){
                console.log(e);
                    alert(txt+e);
                }
            }
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/js/循环语句.html" class="navigation navigation-prev " aria-label="Previous page: 循环语句"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/js/ES6.html" class="navigation navigation-next " aria-label="Next page: ES6"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
